// a client record
function factory(clientInfo, socket) {
	return new ClientOne(clientInfo, socket);
}

function ClientOne(clientInfo, socket) {
	this.clientInfo = clientInfo;
	this.socket = socket;
	this.lastTick = new Date().getTime();
}

ClientOne.prototype.isAlive = function() {
	return this.socket.writable;
}

ClientOne.prototype.isSame = function(anotherRecord) {
	return this.clientInfo === anotherRecord.clientInfo;
}

ClientOne.prototype.refresh = function() {
	console.log('refresh');
	this.lastTick = new Date().getTime();
}

ClientOne.prototype.finish = function() {
	console.log('finish');
	this.socket.end();
	this.clientInfo = null;
	this.lastTick = null;
}

exports = module.exports = {
	newInstance: factory
}